<html>
  <head><title>SP Objects</title>
    <script src="codepress/codepress.js" type="text/javascript"></script> 
    <link rel="stylesheet" href="style.css" type="text/css" media="all" />
  </head>
  <body>

    <h1>Procedure Object: F_QT_LAST_APR_DATE.SQL</h1>
    <p><b>Author:</b> </p>
    <p><b>Date:</b> </p>
    <p><b>Abstract:</b></p>
    <p></b></p>
    <p><b>Sample Calls:</b></p>
    <p>      Vaules(F_QT_LAST_APR_DATE(char('000012345'),1))<br>  </b></p>
    <p></p>
    
    
    
    
    
    
    
    
    
    <h3>Source code:</h3>
    <div id="SQLsrc" >
<em>DROP</em>&nbsp;SPECIFIC&nbsp;<b>FUNCTION</b>&nbsp;EBIZ1.F_QT_LAST_APR_DATE<br />@<br /><em>CREATE</em>&nbsp;<b>FUNCTION</b>&nbsp;EBIZ1.F_QT_LAST_APR_DATE(<br />&nbsp;&nbsp;&nbsp;&nbsp;piWebQuoteNum&nbsp;&nbsp;<u>CHAR</u>(10),<br />&nbsp;&nbsp;&nbsp;&nbsp;piLvl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>INTEGER</u><br />)&nbsp;<b>RETURNS</b>&nbsp;<u>TIMESTAMP</u><br />&nbsp;&nbsp;&nbsp;&nbsp;SPECIFIC&nbsp;EBIZ1.F_QT_LAST_APR_DATE<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>LANGUAGE</b>&nbsp;<b>SQL</b><br />&nbsp;&nbsp;&nbsp;&nbsp;<b>NOT</b>&nbsp;DETERMINISTIC<br />&nbsp;&nbsp;&nbsp;&nbsp;READS&nbsp;<b>SQL</b>&nbsp;DATA<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>NO</b>&nbsp;EXTERNAL&nbsp;ACTION<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>RETURN</b><br /><i>-----------------------------------------------------------------------------------</i><br /><i>--&nbsp;&nbsp;<b>Function</b>&nbsp;Name:&nbsp;F_QT_LAST_APR_DATE</i><br /><i>--&nbsp;&nbsp;File&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;F_QT_LAST_APR_DATE.<b>sql</b></i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;Will&nbsp;Chang</i><br /><i>--&nbsp;&nbsp;<u>Date</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;Aug.&nbsp;15,&nbsp;2007</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Abstract</i><br /><br /><i>--The&nbsp;<u>date</u>&nbsp;<b>and</b>&nbsp;<b>time</b>&nbsp;the&nbsp;last&nbsp;action&nbsp;was&nbsp;taken:</i><br /><i>--<b>If</b>&nbsp;the&nbsp;approver&nbsp;<b>is</b>&nbsp;the&nbsp;first&nbsp;level&nbsp;approver&nbsp;<b>for</b>&nbsp;the&nbsp;quote:</i><br /><i>--	&nbsp;<b>If</b>&nbsp;the&nbsp;approver&nbsp;had&nbsp;previously&nbsp;returned&nbsp;the&nbsp;bid&nbsp;<b>for</b>&nbsp;additional&nbsp;information&nbsp;<b>and</b>&nbsp;</i><br /><i>--	&nbsp;	the&nbsp;sales&nbsp;rep&nbsp;had&nbsp;provided&nbsp;the&nbsp;information,&nbsp;display&nbsp;the&nbsp;<u>date</u>&nbsp;<b>and</b>&nbsp;<b>time</b>&nbsp;the&nbsp;additional&nbsp;information&nbsp;was&nbsp;provided</i><br /><i>--	&nbsp;Otherwise&nbsp;<b>return</b>&nbsp;<b>null</b></i><br /><i>--<b>If</b>&nbsp;the&nbsp;approver&nbsp;<b>is</b>&nbsp;<b>not</b>&nbsp;the&nbsp;first&nbsp;level&nbsp;approver,&nbsp;</i><br /><i>--	&nbsp;display&nbsp;the&nbsp;<u>date</u>&nbsp;<b>and</b>&nbsp;<b>time</b>&nbsp;the&nbsp;previous&nbsp;approver&nbsp;approved&nbsp;the&nbsp;quote</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Sample&nbsp;Calls:</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vaules(F_QT_LAST_APR_DATE(<u>char</u>(<s>'000012345'</s>),1))</i><br /><i>--&nbsp;&nbsp;Maintenance&nbsp;Log</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;who&nbsp;&nbsp;<u>date</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><em>comment</em></b></i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;---&nbsp;&nbsp;--------&nbsp;&nbsp;---------------------------------------------------------------</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;Will&nbsp;&nbsp;08/15/07&nbsp;&nbsp;Initial&nbsp;version</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;Will&nbsp;&nbsp;08/17/07&nbsp;&nbsp;Fix&nbsp;the&nbsp;logic&nbsp;<b>to</b>&nbsp;<b>get</b>&nbsp;min&nbsp;approval&nbsp;level.</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;Will&nbsp;&nbsp;09/10/07&nbsp;<b>add</b>&nbsp;INACT_FLAG&nbsp;condiction</i><br /><i>-----------------------------------------------------------------------------------</i><br />&nbsp;&nbsp;&nbsp;<b>CASE</b><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>WHEN</b>&nbsp;&nbsp;piLvl&nbsp;=(<em>SELECT</em>&nbsp;MIN(SPECL_BID_APPRVR_LVL)&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>FROM</b>&nbsp;ebiz1.WEB_QUOTE_SPECL_BID_APPRVR&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbs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p;&nbsp;<b>AND</b>&nbsp;USER_ROLE=<s>'submitter'</s>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>ELSE</b>&nbsp;(<br />			<em>SELECT</em>&nbsp;&nbsp;MAX(MOD_DATE)&nbsp;<br />	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>FROM</b>&nbsp;ebiz1.WEB_QUOTE_APPRVR_ACTION_HISTORY&nbsp;<br />			<b>WHERE</b>&nbsp;&nbsp;WEB_QUOTE_NUM&nbsp;=&nbsp;piWebQuoteNum&nbsp;<br />	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>AND</b>&nbsp;USER_ACTION&nbsp;=&nbsp;<s>'APPROVE'</s><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;<em>END</em><br />@<br /><br />CALL&nbsp;DTOL.G_FN_EXEC_GRP(<s>'EBIZ1'</s>,&nbsp;<s>'F_QT_LAST_APR_DATE'</s>,&nbsp;<s>'public'</s>)<br />@<br /><br />
    </div> 
  </body>
</html>
